package com.un.ebs.sys.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author zc
 * @ClassName DisplayEnums
 * @Description
 * @Date 2021/2/22
 */
@Getter
public enum DisplayEnums {

    IS_DELETE("is_delete", "是否删除"),
    TENANT_ID("tenant_id", "租户ID"),
    WORKFLOW_INSTANCE_ID("workflow_instance_id", "工作流id"),
    WORKFLOW_PASS_STATUS("workflow_pass_status", "工作流状态"),
    IDX_NUM("idx_num", "排序编号"),
    PARENT_ID("parent_id", "节点id"),
    CREATE_USER_ID("create_user_id", "创建用户ID"),
    CREATE_PERSON_NAME("create_person_name", "创建用户"),
    CREATE_TIME("create_time", "创建时间"),
    UPDATE_USER_ID("update_user_id", "更新用户ID"),
    UPDATE_PERSON_NAME("update_person_name", "更新用户"),
    UPDATE_TIME("update_time", "更新时间"),
    SUBMIT_STATUS("submit_status", "提交状态"),
    SUBMIT_USER_ID("submit_user_id", "提交用户id"),
    SUBMIT_PERSONAL_NAME("submit_personal_name", "提交姓名"),
    SUBMIT_TIME("submit_time", "提交时间"),
    AUDIT_STATUS("audit_status", "审核状态"),
    AUDIT_USER_ID("audit_user_id", "审核用户id"),
    AUDIT_PERSONAL_NAME("audit_personal_name", "审核人姓名"),
    AUDIT_TIME("audit_time", "审核时间");

    private final String columnName;
    private final String desc;

    DisplayEnums(String columnName, String desc) {
        this.columnName = columnName;
        this.desc = desc;
    }

    public static DisplayEnums getEnumByColumnName(String columnName) {
        for (DisplayEnums displayEnums : DisplayEnums.values()) {
            if (columnName.equals(displayEnums.getColumnName())) {
                return displayEnums;
            }
        }
        return null;
    }

    public static List<String> getColumnNameList() {
        List<String> list = new ArrayList<>();
        for (DisplayEnums displayEnums : DisplayEnums.values()) {
            list.add(displayEnums.getColumnName());
        }
        return list;
    }
}
